// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

impl gaxi::prost::ToProto<Date> for gtype::model::Date {
    type Output = Date;
    fn to_proto(self) -> std::result::Result<Date, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            year: self.year.to_proto()?,
            month: self.month.to_proto()?,
            day: self.day.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<gtype::model::Date> for Date {
    fn cnv(self) -> std::result::Result<gtype::model::Date, gaxi::prost::ConvertError> {
        Ok(
            gtype::model::Date::new()
                .set_year(self.year)
                .set_month(self.month)
                .set_day(self.day)
        )
    }
}

impl gaxi::prost::ToProto<Expr> for gtype::model::Expr {
    type Output = Expr;
    fn to_proto(self) -> std::result::Result<Expr, gaxi::prost::ConvertError> {
        Ok(Self::Output {
            expression: self.expression.to_proto()?,
            title: self.title.to_proto()?,
            description: self.description.to_proto()?,
            location: self.location.to_proto()?,
        })
    }
}

impl gaxi::prost::FromProto<gtype::model::Expr> for Expr {
    fn cnv(self) -> std::result::Result<gtype::model::Expr, gaxi::prost::ConvertError> {
        Ok(
            gtype::model::Expr::new()
                .set_expression(self.expression)
                .set_title(self.title)
                .set_description(self.description)
                .set_location(self.location)
        )
    }
}
